Repository Public
1/**2 * =============================================================================3 * SP BOUCHER | SOFTWARE & RESEARCH4 * ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project : ORIX App Universe8 * File : src/app/[locale]/apps/[slug]/page.tsx9 * Module : app10 * Repository : https://git.spboucher.ai/orix-spboucher-ai11 * Project Website : https://www.orixlab.dev12 * Created : 2026-11-2113 * Last Modified : 2026-11-2114 *15 * Author : Simon-Pierre Boucher16 * Position : Professor of Finance17 * Institution : Université du Québec en Outaouais (UQO)18 * Organization : SP Boucher19 * Website : https://spboucher.ai20 * Git : https://git.spboucher.ai21 *22 * Preferred Contact: support@spboucher.ai23 * Development : dev@spboucher.ai24 * Support : support@spboucher.ai25 * Security/Admin : admin@spboucher.ai26 *27 * Copyright (c) 202628 * Simon-Pierre Boucher29 * All rights reserved where applicable. This file is governed by the30 * applicable project license, copyright notices and relevant law.31 * Existing third-party rights and notices remain unaffected.32 *33 * License : None specified (no license file in this repository)34 *35 * Do not embed credentials, private keys, access tokens,36 * certificates or confidential personal information.37 *38 * =============================================================================39 * END OF SP BOUCHER SOURCE HEADER40 * =============================================================================41 */4243import type { Metadata } from "next";44import Image from "next/image";45import Link from "next/link";46import { notFound } from "next/navigation";47import { AppCard } from "@/components/apps/AppCard";48import { DeviceFrame } from "@/components/apps/DeviceFrame";49import { Gallery, type Shot } from "@/components/apps/Gallery";50import { PrimaryAction } from "@/components/apps/PrimaryAction";51import { DownloadPanel } from "@/components/downloads/DownloadPanel";52import { AppIcon } from "@/components/ui/AppIcon";53import { PlatformBadges, StatusBadge } from "@/components/ui/Badges";54import { Starfield } from "@/components/hero/Starfield";55import type { Platform, Status } from "@/models/constants";56import { Reveal } from "@/components/ui/Reveal";57import { currentAdmin } from "@/lib/auth/session";58import { getApp, listApps } from "@/lib/catalog";59import { dict, fmtBytes, fmtDate, href, isLocale, tr, type Locale } from "@/lib/i18n";60import { imageSize } from "@/lib/images";61import { changelog } from "@/lib/news";62import { latestArtifact, versionLabel } from "@/lib/releases/store";63import { alternates, softwareLd } from "@/lib/seo";64import { iconUrl, shotUrl, toCard } from "@/lib/view";6566type Params = { params: Promise<{ locale: string; slug: string }>; searchParams: Promise<{ preview?: string }> };6768/** Drafts and unpublished applications are visible only to a signed-in administrator who asks for the preview. */69async function load(slug: string, preview: boolean) {70 if (preview && (await currentAdmin())) return { row: getApp(slug, { all: true, preview: true }), preview: true };71 return { row: getApp(slug), preview: false };72}7374export async function generateMetadata({ params, searchParams }: Params): Promise<Metadata> {75 const { locale: raw, slug } = await params; const locale: Locale = isLocale(raw) ? raw : "en";76 const { row, preview } = await load(slug, (await searchParams).preview === "1");77 if (!row) return {};78 const a = row.app, title = (a.seo?.title && tr(a.seo.title, locale)) || `${a.name} — ${tr(a.tagline, locale)}`, description = (a.seo?.description && tr(a.seo.description, locale)) || tr(a.summary, locale);79 return { title: { absolute: `${title} · ORIX` }, description, alternates: alternates(`/apps/${slug}`, locale), robots: preview ? { index: false } : undefined, openGraph: { title, description, type: "website" } };80}8182const OS = { ios: "iOS", ipados: "iPadOS", macos: "macOS" } as const;8384export default async function AppPage({ params, searchParams }: Params) {85 const { locale: raw, slug } = await params; const locale: Locale = isLocale(raw) ? raw : "en";86 const { row, preview } = await load(slug, (await searchParams).preview === "1");87 if (!row) notFound();88 const a = row.app, t = dict(locale), card = toCard(row, locale), artifact = latestArtifact(slug);89 const shots: Shot[] = (await Promise.all(a.screenshots.map(async (s) => { const size = await imageSize(slug, s.file); return size ? { src: shotUrl(slug, s.file), ...size, device: s.device, caption: tr(s.caption, locale), file: s.file, hero: !!s.hero } : null; }))).filter((s) => s !== null);90 const hero = (shots as (Shot & { hero: boolean })[]).find((s) => s.hero) ?? shots[0];91 const byFile = new Map((shots as (Shot & { file: string })[]).map((s) => [s.file, s]));92 const log = changelog(slug, locale);93 const related = listApps().filter((r) => r.slug !== slug).sort((x, y) => Number(y.app.category === a.category) - Number(x.app.category === a.category) || Number(y.app.platforms.some((p) => a.platforms.includes(p))) - Number(x.app.platforms.some((p) => a.platforms.includes(p))) || x.app.order - y.app.order).slice(0, 3);94 const released = a.status === "available" || a.status === "beta";9596 const specs: [string, React.ReactNode][] = [97 [t.app.spec.platform, a.platforms.map((p) => `${t.platforms[p]} (${OS[p]})`).join(" · ")],98 [t.app.spec.minOS, Object.keys(a.minOS).length ? a.platforms.filter((p) => a.minOS[p]).map((p) => `${OS[p]} ${a.minOS[p]}`).join(" · ") : t.app.spec.na],99 [t.app.spec.arch, a.architectures.length ? a.architectures.join(", ") : t.app.spec.na],100 [t.app.spec.version, (artifact ? versionLabel(artifact) : null) ?? (a.version ? `${a.version}${a.build ? ` (${a.build})` : ""}${released ? "" : ` — ${t.app.spec.notReleased.toLowerCase()}`}` : t.app.spec.notReleased)],101 [t.app.spec.released, artifact?.published_at ? fmtDate(artifact.tag_date ?? artifact.published_at, locale) : log[0] && released ? fmtDate(log[0].date, locale) : t.app.spec.notReleased],102 artifact?.asset_size ? [t.app.spec.size, fmtBytes(artifact.asset_size, locale)] : a.downloadSize ? [t.app.spec.exportSize, fmtBytes(a.downloadSize.bytes, locale)] : [t.app.spec.size, t.app.spec.na],103 [t.app.spec.permissions, a.specs.permissions.length ? <ul className="grid gap-1.5">{a.specs.permissions.map((p, i) => <li key={i}>{tr(p, locale)}</li>)}</ul> : t.app.spec.none],104 [t.app.spec.offline, tr(a.specs.offline, locale) || t.app.spec.na],105 [t.app.spec.languages, a.specs.languages.length ? a.specs.languages.map((l) => t.app.langs[l] ?? l).join(" · ") : t.app.spec.na],106 ...(a.specs.dependencies && tr(a.specs.dependencies, locale) ? [[t.app.spec.dependencies, tr(a.specs.dependencies, locale)] as [string, React.ReactNode]] : []),107 ...(a.bundleId ? [[t.app.spec.bundle, <span key="b" className="mono text-[0.9rem]">{a.bundleId}</span>] as [string, React.ReactNode]] : []),108 [t.app.spec.source, a.repo.visibility === "public" && a.repo.name ? <a key="s" className="link" href={`https://git.spboucher.ai/${a.repo.name}`} rel="noopener">{t.app.sourcePublic} · git.spboucher.ai/{a.repo.name}</a> : a.repo.visibility === "private" ? t.app.sourcePrivate : t.app.sourceNone],109 ];110 const nav: [string, string][] = [["overview", t.app.overview], ["features", t.app.features], ...(shots.length ? [["gallery", t.app.gallery] as [string, string]] : []), ["specs", t.app.specs], ["downloads", t.app.downloads], ["changelog", t.app.changelog], ["privacy", t.app.privacy], ...(a.faq.length ? [["faq", t.app.faq] as [string, string]] : [])];111112 return (113 <article style={{ "--accent": a.accent ?? "var(--blue)" } as React.CSSProperties} data-testid="app-page" data-slug={slug}>114 {!preview && <script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(softwareLd(a, locale, artifact)) }} />}115 {preview && <p className="fixed inset-x-0 bottom-0 z-50 bg-[var(--warn)] px-4 py-2 text-center text-sm font-semibold text-black" data-testid="preview-banner">{t.app.previewBanner}</p>}116117 <header className="relative isolate overflow-hidden pb-16 pt-32 sm:pt-40">118 <div aria-hidden className="pointer-events-none absolute left-1/2 top-[-22rem] -z-10 h-[52rem] w-[72rem] -translate-x-1/2 rounded-full blur-3xl" style={{ background: "radial-gradient(closest-side, color-mix(in oklab, var(--accent) calc(var(--glow) * 70%), transparent), transparent)" }} />119 <Starfield density={0.55} className="-z-10" /><div className="gridlines -z-10" aria-hidden />120 <div className={`wrap wrap-wide grid items-center gap-x-14 gap-y-14 ${hero ? (hero.device === "iphone" ? "lg:grid-cols-[1.15fr_0.85fr]" : "lg:grid-cols-2") : ""}`}>121 <div className={hero ? "" : "mx-auto max-w-3xl text-center"}>122 <AppIcon name={a.name} src={iconUrl(a)} size={120} priority className={hero ? "" : "mx-auto"} />123 <div className={`mt-8 flex flex-wrap items-center gap-x-4 gap-y-2 ${hero ? "" : "justify-center"}`}>124 <StatusBadge status={a.status} locale={locale} />125 {(Object.entries(a.platformStatus ?? {}) as [Platform, Status][]).filter(([p, st]) => st !== a.status && p !== "ipados").map(([p, st]) => <span key={p} className="status" data-s={st} data-testid="platform-status">{p === "ios" && a.platforms.includes("ipados") ? `${t.platforms.ios} · ${t.platforms.ipados}` : t.platforms[p]} — {t.status[st]}</span>)}126 <PlatformBadges platforms={a.platforms} locale={locale} />127 <span className="tag">{t.categories[a.category]}</span>128 </div>129 <h1 className="h1 mt-5">{a.name}</h1>130 <p className={`mt-4 text-[clamp(1.3rem,2.4vw,1.9rem)] font-medium leading-tight tracking-tight text-ink2 ${hero ? "max-w-xl" : ""}`}>{tr(a.tagline, locale)}</p>131 <div className={`mt-9 flex flex-wrap items-center gap-3 ${hero ? "" : "justify-center"}`}>132 {card.action.kind === "details"133 ? <a href="#downloads" className="btn btn-ghost" data-testid="hero-availability">{a.status === "coming-soon" ? t.action.comingSoon : a.platforms.includes("macos") ? (a.status === "unavailable" || a.status === "available" ? t.action.noRelease : t.action.comingSoon) : t.action.betaSoon}</a>134 : <PrimaryAction app={card} locale={locale} />}135 <a href="#features" className="link text-[0.95rem] font-semibold">{t.app.features}</a>136 </div>137 {card.action.kind !== "details" && <p className="mono mt-4 text-[0.78rem] text-ink3">v{artifact ? versionLabel(artifact) : a.version}{a.platforms.map((p) => (a.minOS[p] ? ` · ${OS[p]} ${a.minOS[p]}+` : "")).join("")}</p>}138 </div>139 {hero && (140 <div className="relative mx-auto w-full" style={{ maxWidth: hero.device === "iphone" ? 330 : hero.device === "ipad" ? 560 : 720 }}>141 <DeviceFrame device={hero.device}><Image src={hero.src} alt={hero.caption} width={hero.width} height={hero.height} priority sizes={hero.device === "iphone" ? "330px" : "(max-width: 1024px) 90vw, 720px"} /></DeviceFrame>142 {!released && <p className="mono mt-3 text-center text-[0.72rem] uppercase tracking-[0.12em] text-ink3">{t.app.devBuild}</p>}143 </div>144 )}145 </div>146 </header>147148 <nav aria-label={a.name} className="rule sticky top-16 z-30 border-b border-line bg-[color-mix(in_oklab,var(--bg)_82%,transparent)] backdrop-blur-xl">149 <ul className="wrap wrap-wide scroll-x flex gap-1 py-2">{nav.map(([id, l]) => <li key={id}><a href={`#${id}`} className="block whitespace-nowrap rounded-full px-3.5 py-1.5 text-[0.88rem] font-medium text-ink2 hover:text-ink">{l}</a></li>)}</ul>150 </nav>151152 <section id="overview" className="section" aria-labelledby="overview-h">153 <div className="wrap grid gap-10 lg:grid-cols-[14rem_1fr]">154 <h2 id="overview-h" className="eyebrow self-start">{t.app.overview}</h2>155 <Reveal className="prose max-w-3xl text-[clamp(1.15rem,1.7vw,1.4rem)] leading-[1.5] text-ink2 [&>p:first-child]:text-ink">156 {tr(a.description, locale).split(/\n{2,}/).map((p, i) => <p key={i}>{p}</p>)}157 </Reveal>158 </div>159 </section>160161 <section id="features" className="section rule bg-bg2" aria-labelledby="features-h">162 <div className="wrap wrap-wide">163 <h2 id="features-h" className="h2">{t.app.features}</h2>164 <ul className="mt-12 grid gap-x-10 gap-y-10 sm:grid-cols-2 lg:grid-cols-3">165 {a.features.map((f, i) => (166 <Reveal as="li" key={i} delay={(i % 3) * 70} className="border-t border-line2 pt-5">167 <span className="mono accent-text text-[0.7rem] tracking-[0.14em]">{String(i + 1).padStart(2, "0")}</span>168 <h3 className="mt-2 text-[1.12rem] font-semibold leading-snug tracking-tight">{tr(f.title, locale)}</h3>169 <p className="mt-2 text-[0.97rem] leading-relaxed text-ink2">{tr(f.body, locale)}</p>170 </Reveal>171 ))}172 </ul>173 </div>174 </section>175176 <section id="gallery" className="section" aria-labelledby="gallery-h">177 <div className="wrap wrap-wide"><h2 id="gallery-h" className="h2">{t.app.gallery}</h2></div>178 {shots.length179 ? <div className="mt-12"><Gallery shots={shots.map(({ src, width, height, device, caption }) => ({ src, width, height, device, caption }))} labels={{ open: t.app.openShot, prev: t.app.prev, next: t.app.next, close: t.app.closeShot, counter: t.app.shot(-1, -2).replace("-1", "{i}").replace("-2", "{n}") }} /></div>180 : <div className="wrap wrap-wide"><p className="card mt-10 p-10 text-center text-ink2" data-testid="no-shots">{t.app.noShots}</p></div>}181 </section>182183 {a.deepDives.length > 0 && (184 <section className="section rule" aria-labelledby="deep-h">185 <div className="wrap wrap-wide">186 <h2 id="deep-h" className="eyebrow">{t.app.deep}</h2>187 <div className="mt-10 grid gap-24">188 {a.deepDives.map((d, i) => {189 const s = d.screenshot ? byFile.get(d.screenshot) : undefined;190 return (191 <Reveal key={i} className={`grid items-center gap-10 ${s ? "lg:grid-cols-2" : ""}`}>192 <div className={s && i % 2 ? "lg:order-2" : ""}>193 <h3 className="h2">{tr(d.title, locale)}</h3>194 <p className="mt-5 max-w-xl text-[1.08rem] leading-relaxed text-ink2">{tr(d.body, locale)}</p>195 </div>196 {s && <div className="mx-auto w-full" style={{ maxWidth: s.device === "iphone" ? 300 : 620 }}><DeviceFrame device={s.device}><Image src={s.src} alt={s.caption} width={s.width} height={s.height} sizes={s.device === "iphone" ? "300px" : "(max-width: 1024px) 90vw, 620px"} /></DeviceFrame></div>}197 </Reveal>198 );199 })}200 </div>201 </div>202 </section>203 )}204205 <section id="specs" className="section rule bg-bg2" aria-labelledby="specs-h">206 <div className="wrap grid gap-10 lg:grid-cols-[14rem_1fr]">207 <h2 id="specs-h" className="eyebrow self-start">{t.app.specs}</h2>208 <dl className="border-t border-line2" data-testid="specs">209 {specs.map(([k, v]) => (210 <div key={k} className="grid gap-1 border-b border-line py-4 sm:grid-cols-[13rem_1fr] sm:gap-6">211 <dt className="text-[0.9rem] font-semibold text-ink2">{k}</dt><dd className="text-[0.98rem]">{v}</dd>212 </div>213 ))}214 </dl>215 </div>216 </section>217218 <section id="downloads" className="section" aria-labelledby="downloads-h">219 <div className="wrap grid gap-10 lg:grid-cols-[14rem_1fr]">220 <h2 id="downloads-h" className="eyebrow self-start">{t.app.downloads}</h2>221 <DownloadPanel app={a} locale={locale} />222 </div>223 </section>224225 <section id="changelog" className="section rule" aria-labelledby="changelog-h">226 <div className="wrap grid gap-10 lg:grid-cols-[14rem_1fr]">227 <h2 id="changelog-h" className="eyebrow self-start">{t.app.changelog}</h2>228 {log.length === 0 ? <p className="text-ink2" data-testid="changelog-empty">{t.log.none}</p> : (229 <ol className="border-l border-line2" data-testid="changelog">230 {log.map((e) => (231 <li key={e.version} className="relative pb-10 pl-7 last:pb-0">232 <span aria-hidden className="absolute -left-[5px] top-2 h-[9px] w-[9px] rounded-full bg-[var(--accent)] ring-4 ring-bg" />233 <div className="flex flex-wrap items-baseline gap-x-4 gap-y-1">234 <h3 className="mono text-[1.05rem] font-semibold">{e.version}{e.build ? ` (${e.build})` : ""}</h3>235 <time dateTime={e.date} className="text-[0.88rem] text-ink3">{fmtDate(e.date, locale)}</time>236 <span className="tag">{t.log.channels[e.channel] ?? e.channel}</span>237 {e.tag && <span className="mono text-[0.78rem] text-ink3">{t.log.tag} {e.tag}</span>}238 </div>239 <ul className="mt-3 grid gap-1.5 text-[0.98rem] text-ink2">{e.notes.map((n, i) => <li key={i}>{n}</li>)}</ul>240 {e.download && <p className="mt-3"><a className="link mono text-[0.88rem]" href={e.download.href} download>{e.download.name}{e.download.size ? ` · ${fmtBytes(e.download.size, locale)}` : ""}</a></p>}241 </li>242 ))}243 </ol>244 )}245 </div>246 </section>247248 <section id="privacy" className="section rule bg-bg2" aria-labelledby="privacy-h">249 <div className="wrap grid gap-10 lg:grid-cols-[14rem_1fr]">250 <h2 id="privacy-h" className="eyebrow self-start">{t.app.privacy}</h2>251 <div className="max-w-3xl">252 <p className="text-[clamp(1.15rem,1.7vw,1.4rem)] leading-[1.5]">{tr(a.privacy.summary, locale)}</p>253 <ul className="mt-8 grid gap-3 text-ink2">{a.privacy.points.map((p, i) => <li key={i} className="flex gap-3"><span aria-hidden className="mt-[0.7em] h-px w-4 flex-none bg-[var(--accent)]" />{tr(p, locale)}</li>)}</ul>254 <div className="card mt-10 p-6" data-testid="verification">255 <h3 className="text-[0.78rem] font-semibold uppercase tracking-[0.12em] text-ink3">{t.app.verification}</h3>256 <p className="mt-3 font-semibold">{a.verification.testedOnDevice ? t.app.testedOnDevice : t.app.notTestedOnDevice}</p>257 {a.verification.tests && <p className="mt-2 text-[0.95rem] text-ink2">{tr(a.verification.tests, locale)}</p>}258 <p className="mt-2 text-[0.95rem] text-ink2">{tr(a.verification.notes, locale)}</p>259 </div>260 </div>261 </div>262 </section>263264 {a.faq.length > 0 && (265 <section id="faq" className="section" aria-labelledby="faq-h">266 <div className="wrap grid gap-10 lg:grid-cols-[14rem_1fr]">267 <h2 id="faq-h" className="eyebrow self-start">{t.app.faq}</h2>268 <div className="max-w-3xl border-t border-line2">269 {a.faq.map((f, i) => (270 <details key={i} className="faq border-b border-line">271 <summary className="flex items-center justify-between gap-6 py-5 text-[1.08rem] font-semibold tracking-tight">{tr(f.q, locale)}272 <svg className="plus flex-none text-ink3" width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden><path d="M8 2v12M2 8h12" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" /></svg>273 </summary>274 <p className="pb-6 pr-10 text-ink2">{tr(f.a, locale)}</p>275 </details>276 ))}277 </div>278 </div>279 </section>280 )}281282 <section className="section rule" aria-labelledby="related-h">283 <div className="wrap wrap-wide">284 <div className="flex flex-wrap items-end justify-between gap-4"><h2 id="related-h" className="h2">{t.app.related}</h2><Link className="link text-[0.95rem] font-semibold" href={href(locale, "/apps")}>{t.home.allApps}</Link></div>285 <ul className="mt-10 grid gap-5 md:grid-cols-3">{related.map((r) => <li key={r.slug}><AppCard app={toCard(r, locale)} locale={locale} /></li>)}</ul>286 </div>287 </section>288 </article>289 );290}291